"""
-*- coding: utf-8 -*-
@Time    : 2021/3/21 15:10
@Author  : Hu
@Email   : 624611978@qq.com
@File    : 作业.py
"""
from decimal import Decimal

# 1
for i in range(1000):
    Num = "None"
    error = 0
    try:
        Num = Decimal(input("请输入一个0-100之间的数（输入666可退出）："))
    except:
        error = 1
    if Num == 666:
        print("已退出程序\n")
        break
    elif error == 0:
        if 0<=Num<=100:
            if 85<=Num<=100:
                print("优秀")
            elif 60<=Num<85:
                print("良好")
            else:
                print("不及格")
        else:
            print("您输入的数不在范围内！")
    else:
        print("您输入的不是数字！")

# 2
for i in range(1,4):
    error = 0
    try:
        Num = Decimal(input(f"请猜一个数字（剩余{4-i}次机会）："))
    except:
        error = 1
    if error == 0:
        if Num == 8:
            print(f"猜对了！\n您只用了{i}次\n")
            break
        else:
            print("大了一点" if Num > 8 else "小了一点")
    else:
        print("您输入的不是数字！")
else:
    print("可惜了，机会用完了\n")

# 3
for i in range(100,501):
    for c in range(2,i):
        if i%c == 0:
            break
    else:
        print(i)
else:
    print("")

# 4
Total = 0
for i in range(1,51):
    Total += i
else:
    print(Total)